﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TradingServer.Core.Entities
{
	public class OrderGlassFactory
	{
		public static OrderGlass Get(Security security)
		{
			lock (_locker)
			{
				OrderGlass glass = null;
				if (_glasses.ContainsKey(security)) glass = _glasses[security];

				if (glass != null) return glass;

				glass = new OrderGlass(security);
				_glasses[security] = glass;
				return glass;
			}
		}

		#region Private members

		private static readonly Dictionary<Security, OrderGlass> _glasses = new Dictionary<Security, OrderGlass>();
		private static readonly object _locker = new object();

		#endregion
	}
}
